Add new functions, enums#16
Conversation
Biggest change is that starting with Postgres 12 OID columns in catalog tables were no longer hidden, which required adjusting a few views and tests. Also update pgxntool.
Also, refactor common code between it and function__arg_types()
- Eliminate duplicate NULL array creation logic by restructuring CASE statement - Use pronargs instead of parsing proargtypes text for array size - Move data type definitions and mapping functions to beginning of file - Improve code organization and readability
- Add enum types equivalent to relation_relkind for pg_proc fields: * routine_prokind and routine_type (function/procedure/aggregate/window) * routine_proargmode and routine_argument_mode (in/out/inout/variadic/table) * routine_provolatile and routine_volatility (immutable/stable/volatile) * routine_proparallel and routine_parallel_safety (safe/restricted/unsafe) - Remove explicit type grants, rely on default privileges - Clean up redundant comments in mapping functions - Add comprehensive test suite for new enum types and permissions
54793a3 Merge branch 'master' into upstream/stable ab7f6e2 Stamp 1.0.0 3a571ba Add pg_tle support and modernize test infrastructure (#11) b96ea6d Add support for Claude code; build and doc improvements (#9) e9c24de Fix pg_regress on versions > 12 (#5) git-subtree-dir: pgxntool git-subtree-split: 54793a39251290657767816d23b45d6297f3a671
Versioned files should now be kept in git. Also, fix missing .gitignore
3b8cb2a Stamp 1.1.0 550a901 Remove commit.md (maintained in pgxntool-test) d73ca93 Add unique test database names to prevent conflicts (Postgres-Extensions#13) 9b344be Add update-setup-files.sh for 3-way merging after pgxntool-sync (#12) REVERT: 54793a3 Merge branch 'master' into upstream/stable REVERT: bed3604 Fix pg_regress on versions > 12 (#5) (#6) git-subtree-dir: pgxntool git-subtree-split: 3b8cb2a96c2611bb44b1d69fd533fd0f23fa8995
639756c Stamp 1.1.1 6ba3176 Fix pg_tle exception handler and empty upgrade files (Postgres-Extensions#15) git-subtree-dir: pgxntool git-subtree-split: 639756c43a64717347b82b46acfec5be478a7bbf
PostgreSQL 15 (commit 07eee5a0) moved "char" from TYPCATEGORY_STRING to
TYPCATEGORY_INTERNAL, which removed the implicit I/O coercion path that
allowed "char"::some_enum to work. Replace the "char" overloads for
routine__type, routine__argument_mode, routine__volatility, and
routine__parallel_safety with explicit CREATE CAST ... WITH INOUT AS
IMPLICIT entries.
Also fix two bugs in trigger__parse exposed by PG17:
- current_setting('server_version')::real fails when the version string
includes a distro suffix; switch to server_version_num::int
- pg_get_triggerdef renders temp functions as "pg_temp.f" while ::regproc
gives "pg_temp_N.f", breaking the regexp split on the EXECUTE clause;
replace the name-based pattern with a generic EXECUTE (FUNCTION|PROCEDURE)
regex
Fix PG15+ permission denied on public schema in object_type tests by
granting CREATE ON SCHEMA public to the test role (PG15 revoked this
from PUBLIC by default).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add all new types, casts, and functions to the upgrade file that were
previously only in the versioned install file:
- New routine enum types: routine_prokind, routine_type, routine_proargmode,
routine_argument_mode, routine_provolatile, routine_volatility,
routine_proparallel, routine_parallel_safety, and composite routine_argument
- CREATE CAST ("char" AS ...) WITH INOUT AS IMPLICIT for the four prokind/
proargmode/provolatile/proparallel enums (PG15+ compatibility)
- Functions: routine__type, routine__argument_mode, routine__volatility,
routine__parallel_safety, and trigger__parse(oid) with PG17 fixes
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Resolve conflicts keeping new_functions branch changes: - CI: updated PG version matrix (18..10) and test command - pgxntool: version history, unique REGRESS_DBNAME - trigger__parse: generic EXECUTE regex pattern - Test expected output and setup for new functions
121f0b3 Stamp 2.0.0 ad3ca7e Remove .source support; add test/install, test/build, and verify-results (Postgres-Extensions#18) c010cf8 Fix bash 3.2 compatibility (Postgres-Extensions#23) abeb9d3 Remove .source file support from pg_regress integration (Postgres-Extensions#22) 08c1879 Stamp 1.1.2 6e0dad2 Fix double --dbname bug that defeated unique test database names git-subtree-dir: pgxntool git-subtree-split: 121f0b38fabd1d0ebd2c975254e59421553e2830
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Merge 8 single-function test files into 2 combined suites to reduce repeated setup and keep related tests together: - relation__.sql: relation_type + is_temp + is_catalog + column_names (41 tests) - routine__.sql: routine_type + argument_mode + volatility + parallel_safety (57 tests) Rename conflicting temp table names (test_temp_table → is_temp_test / is_catalog_test) to avoid collision within the merged relation__ suite. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
f6b076a to
312a11c
Compare
…orted ALTER TYPE ... ADD VALUE cannot run inside an extension update script on PG11 or earlier (restriction lifted in PG12). Per project policy, we do not support fresh installs on versions where the update path is broken. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…nore The upgrade-drift feature was never implemented; the three files in test/upgrade-drift/ were Claude session-handoff prompts that should not have been committed. test/.gitignore contained a single `.build` entry that never matched anything (build generates test/build/, not test/.build/). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
All tests in function.sql cover routine__* functions and belong with the rest of the routine__ test suite. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
regprocedure(), deprecated function__arg_types() wrappers, and the _cat_tools helper security-definer checks do not belong in routine__.sql. Move them back to function.sql. Also: the relation_type tests were correctly merged into relation__.sql earlier — relation__kind() and relation__relkind() are relation__ functions. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
# Conflicts: # .github/workflows/ci.yml # HISTORY.asc
- Add test/helpers/enum_mapping.sql: Pattern A psql-variable helper for routine__ enum mapping tests; builds f/enum_type/char_enum_type from kind+char_col, uses greatest() for size-mismatch safety, unsets all variables at end - routine__.sql: replace 4 hand-rolled view+test blocks with 4 \set/\i calls; plan() uses array_length(enum_range()) directly; remove views - relation__.sql: add greatest() comment on kinds view; remove redundant per-function security checks (covered by permissions.sql); consolidate temp tables into one pre-plan() temp_test_table - function.sql: move critical security tests to top; remove redundant regprocedure permission check; label deprecated wrapper test descriptions - permissions.sql: make plan() comments consistent (no_use denied + use allowed) - Update all affected expected output files Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- enum_mapping.sql: rename internal vars to __f/__enum_type/__char_enum_type to avoid conflicts; move greatest() comment inside view; add Set 1/Set 2 section headers; improve count test description to mention both enums; only unset internal __ vars, not caller-provided vars; update top comment to describe both test sets - function.sql: introduce \set _s _cat_tools and use :'_s' in isnt_definer calls instead of hardcoded '_cat_tools' - relation__.sql: restore per-function security throws_ok tests and dedicated temp table creation tests that were incorrectly removed - routine__.sql: break down the +32 plan constant into labeled subsections - routine__.out: update 4 enum size check descriptions to match new wording - relation__.out: update to 1..41 with restored test output lines Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- enum_mapping.sql: correct Set 1/Set 2 labels — Set 1 is the individual example with a fully-specified expected value (rigorous correctness check); Set 2 is the all-values roundtrip (breadth over depth); size check is now a separate prerequisite comment - routine__.sql: reorder functional tests to group related functions together (types: parse_arg_types + isnt_definer × 2 + arg_types + arg_types_text; names: parse_arg_names + isnt_definer × 2 + arg_names + arg_names_text); pg_temp function creation moved to top of SET SESSION AUTH section so both functions are available to all test groups; isnt_definer checks inline with their respective function sections; fix args variable collision with _f_args for isnt_definer calls - permissions.sql: add _cat_tools schema USAGE checks (no_use denied, use allowed); document the defense-in-depth gap for function__arg_to_ regprocedure and function__drop_temp which carry an incidental PUBLIC execute grant but are protected by schema-level USAGE restriction Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
function__arg_to_regprocedure and function__drop_temp were missing an explicit REVOKE, so GRANT TO cat_tools__usage materialized a PUBLIC execute entry in their ACLs. Schema-level USAGE protection was already effective, but defense-in-depth is better. Also update permissions.out: the "char" overloads of routine__argument_mode, routine__parallel_safety, routine__type, and routine__volatility are now correctly reflected in the expected output (they were absent from the cached file). Update the _cat_tools comment in permissions.sql to reflect that the REVOKE is now in place. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ests - Use leading comma format in throws_ok call (trailing comma was wrong style) - Move CREATE FUNCTION pg_temp.test_function/named_function to just before the routine__arg_types tests where they are first used - Add \set named_args and use :'named_args' consistently throughout Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 21 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (9)
📝 WalkthroughWalkthroughThis pull request releases cat_tools 0.3.0 with routine, relation, object, catalog, and trigger introspection APIs. It adds fresh-install and extension-update SQL scripts, updates version metadata, narrows PostgreSQL support to versions 12–18, revises build and CI workflows, and removes obsolete upgrade-test generation. New tests cover routine parsing, permissions, enum mappings, relation helpers, deprecated wrappers, and PostgreSQL extension updates. Estimated code review effort: 4 (Complex) | ~60 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…irst use Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@coderabbitai full review and please use the github review functionality |
There was a problem hiding this comment.
Actionable comments posted: 6
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
sql/cat_tools.sql.in (1)
1785-1787:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winDon't feed an unescaped relation name into a regex split.
v_on_clauseincludesr_trigger.tgrelid::pg_catalog.regclass, then gets passed straight toregexp_split_to_array. Valid quoted identifiers can contain.,+,(, etc., sotrigger__parse()will mis-parse or fail on those names. Prefer literal slicing withstrpos/substr, or escape the pattern before calling the regex function. Please mirror the same fix intosql/cat_tools--0.2.2--0.3.0.sql.in, which embeds the same parser.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@sql/cat_tools.sql.in` around lines 1785 - 1787, The code builds v_on_clause using r_trigger.tgrelid::pg_catalog.regclass and then passes it into regexp_split_to_array, which can break on valid quoted relation names; update trigger__parse() to avoid using an unescaped regex pattern by either escaping v_on_clause before calling regexp_split_to_array or, preferably, replace the regex split with literal slicing using strpos/substr on v_work and v_on_clause to extract parts into v_array and events; apply the same change to the duplicate parser in sql/cat_tools--0.2.2--0.3.0.sql.in so both copies use safe literal splitting or properly escaped patterns.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/ci.yml:
- Around line 63-65: The EXPECTED_VERSION extraction using sed should be
hardened: after running the sed extraction that sets EXPECTED_VERSION in the
environment, add an explicit check that EXPECTED_VERSION is non-empty and fail
fast (exit non-zero) if empty; similarly, wherever you compare VERSION to
EXPECTED_VERSION (currently using grep -qF), replace those checks with explicit
non-empty validation of VERSION and an exact string equality comparison [
"$VERSION" = "$EXPECTED_VERSION" ] (i.e., ensure VERSION is not empty, then
compare exact equality), and remove the use of grep -qF to avoid partial
matches; reference the variables EXPECTED_VERSION and VERSION and the sed
extraction that writes to GITHUB_ENV when applying these changes.
In `@HISTORY.asc`:
- Line 17: Replace the "TODO" placeholder under the 0.3.0 release heading in
HISTORY.asc with the actual change bullets for version 0.3.0: list concise,
user-facing entries (bug fixes, new features, breaking changes, and notable
internal changes) as individual dash-prefixed lines so the release section is
complete and readable; ensure the bullets reference the corresponding
commits/PRs or short descriptions and keep formatting consistent with other
release sections in the file.
In `@META.in.json`:
- Line 17: Update the advertised PostgreSQL prerequisite to match the package
version: change the prereqs.build.requires.PostgreSQL value in META.in.json
(look for the JSON key path prereqs.build.requires.PostgreSQL) from "9.2.0" to
"12.0" so it aligns with "version": "0.3.0", then regenerate META.json from
META.in.json to propagate the change (ensure the updated value appears in the
generated META.json).
In `@README.asc`:
- Line 33: Remove the stray trailing backtick in the `routine_volatility` bullet
(the text currently reads "* `routine_volatility` - Volatility levels for
functions/procedures`") and correct the possessive on line 87 from "it's full
set of arguments" to "its full set of arguments"; update the README.asc entries
accordingly, keeping the backticks around `routine_volatility` but deleting the
extra backtick at the end and fixing the contraction to the possessive form
"its".
In `@sql/cat_tools--0.2.2--0.3.0.sql.in`:
- Around line 167-169: Revoke the default PUBLIC privileges for the _cat_tools
helpers before granting to cat_tools__usage: add statements to REVOKE USAGE ON
SCHEMA _cat_tools FROM PUBLIC and REVOKE EXECUTE ON FUNCTION for each helper
function (_cat_tools.function__arg_to_regprocedure(text,text,text) and
_cat_tools.function__drop_temp(pg_catalog.regprocedure,text)) from PUBLIC,
placed immediately before the existing GRANT lines so updated databases don't
retain broader ACLs.
In `@sql/cat_tools.sql.in`:
- Around line 372-414: The relkind mappings are wrong in the SQL functions
cat_tools.relation__kind and cat_tools.relation__relkind: swap the labels so
that 'c' maps to 'composite type', 'f' maps to 'foreign table', and 'm' maps to
'materialized view' in relation__kind, and reverse those mappings in
relation__relkind (i.e. kind 'composite type' -> 'c', 'foreign table' -> 'f',
'materialized view' -> 'm') so fresh installs match the 0.2.2→0.3.0 update path.
---
Outside diff comments:
In `@sql/cat_tools.sql.in`:
- Around line 1785-1787: The code builds v_on_clause using
r_trigger.tgrelid::pg_catalog.regclass and then passes it into
regexp_split_to_array, which can break on valid quoted relation names; update
trigger__parse() to avoid using an unescaped regex pattern by either escaping
v_on_clause before calling regexp_split_to_array or, preferably, replace the
regex split with literal slicing using strpos/substr on v_work and v_on_clause
to extract parts into v_array and events; apply the same change to the duplicate
parser in sql/cat_tools--0.2.2--0.3.0.sql.in so both copies use safe literal
splitting or properly escaped patterns.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: cb7a426f-c0df-4bf9-8378-d71916ce2b42
⛔ Files ignored due to path filters (8)
test/build/expected/build.outis excluded by!**/*.outtest/build/expected/upgrade.outis excluded by!**/*.outtest/expected/function.outis excluded by!**/*.outtest/expected/object_type.outis excluded by!**/*.outtest/expected/permissions.outis excluded by!**/*.outtest/expected/relation__.outis excluded by!**/*.outtest/expected/relation_type.outis excluded by!**/*.outtest/expected/routine__.outis excluded by!**/*.out
📒 Files selected for processing (26)
.github/workflows/ci.yml.gitignoreCLAUDE.mdHISTORY.ascLICENSEMETA.in.jsonMETA.jsonMakefileREADME.asccat_tools.controlcontrol.mksql/cat_tools--0.2.2--0.3.0.sql.insql/cat_tools--0.3.0.sql.insql/cat_tools.sql.intest/build/build.sqltest/build/upgrade.sqltest/deps.sqltest/helpers/enum_mapping.sqltest/load_new.sqltest/setup.sqltest/sql/function.sqltest/sql/object_type.sqltest/sql/permissions.sqltest/sql/relation__.sqltest/sql/relation_type.sqltest/sql/routine__.sql
💤 Files with no reviewable changes (3)
- test/load_new.sql
- test/sql/relation_type.sql
- .gitignore
🧩 Analysis chain
🏁 Script executed: Length of output: 270551
🏁 Script executed: Length of output: 669 🏁 Script executed: Length of output: 3388 🏁 Script executed: Length of output: 5113 🏁 Script executed: Length of output: 194
🏁 Script executed: Length of output: 225
Blocking
Bugs
Docs
Style/minor
If you’d like, I can follow up by:
✅ Actions performedReview triggered.
|
- Fix backwards relkind c/f/m mapping in relation__kind/relation__relkind (was c->materialized view, f->composite type, m->foreign table; correct per pg_class.relkind is c=composite type, f=foreign table, m=materialized view). Fixed in both the fresh-install and 0.2.2->0.3.0 update scripts. - De-tautologize test/sql/relation__.sql: assert the mapping against hard-coded canonical (relkind, type) pairs instead of a positional zip of the two enums, which previously passed for any internally-consistent mapping (including the backwards one). - Revoke EXECUTE from PUBLIC on the _cat_tools helper functions in the update path so updated databases match fresh-install ACLs. - README typos; real 0.3.0 HISTORY bullets; bump PGXN PostgreSQL prereq to 12.0 to match the 0.3.0 support policy. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
These fixtures still described the routine__type(prokind "char") et al. function overloads that were replaced with implicit CREATE CAST ... WITH INOUT in 7473aa7; they were last regenerated against a dirty regression database, so they diverged from a clean fresh install. Regenerated from an actual clean test run (fresh install now creates a single routine__type). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Replace `grep -qF` version comparisons with an empty-value guard plus exact string equality; a partial or empty match previously passed. - Gate every `make test` step on `make verify-results`. pgxntool marks installcheck `.IGNORE`, so `make test` always exits 0 even when pg_regress reports failures; without this gate, regressions pass CI silently (the permissions/routine__ failures were green for months). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (4)
README.asc (1)
23-23: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winUpdate "Supported Versions" to reflect PostgreSQL 12+ requirement.
Line 23 still reads "Works on Postgres 9.3 and above." but 0.3.0 drops PG10/11 and requires PostgreSQL 12+. This was flagged in a prior review and the commit messages claim the README was updated, but this line was missed. The HISTORY.asc correctly documents the PG12-18+ support range.
📝 Suggested fix
-Works on Postgres 9.3 and above. +Works on PostgreSQL 12 and above.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@README.asc` at line 23, Update the README’s supported-version statement from PostgreSQL 9.3 and above to PostgreSQL 12 and above, matching the documented support range in HISTORY.asc..github/workflows/ci.yml (1)
16-36: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick winAdd a top-level
permissions:block to restrict GitHub token scope.The workflow has no
permissions:block, so GitHub Actions defaults to broad write permissions forGITHUB_TOKEN. Follow least-privilege by declaring minimal permissions. For a test-only workflow,contents: readis typically sufficient.🔒 Suggested fix
+permissions: + contents: read + jobs: test:🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/ci.yml around lines 16 - 36, Add a top-level permissions block to the workflow configuration, granting only contents: read for the checkout performed by the test job. Keep the existing test matrix, container, and steps unchanged.Source: Linters/SAST tools
META.json (1)
70-75: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winUpdate stale
X_commentto match the new PostgreSQL 12.0 prerequisite.Line 70 still reads "Requires named argument support in SQL functions, which started in 9.2", but the prerequisite on line 75 is now
12.0. Update the comment inMETA.in.json(the source) and regenerateMETA.jsonto avoid misleading users about the actual minimum version requirement.📝 Suggested fix (apply to META.in.json, then regenerate)
- "X_comment": "Requires named argument support in SQL functions, which started in 9.2", + "X_comment": "Requires PostgreSQL 12+ for ALTER TYPE ... ADD VALUE in extension update scripts",🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@META.json` around lines 70 - 75, Update the X_comment metadata in META.in.json to describe the PostgreSQL 12.0 requirement instead of the outdated 9.2 prerequisite, then regenerate META.json so the generated metadata matches the source and the existing PostgreSQL requires value.sql/cat_tools--0.2.2--0.3.0.sql.in (1)
181-186: 🎯 Functional Correctness | 🔴 Critical | 🏗️ Heavy liftSplit the enum additions into their own upgrade step. The new
relation_type/relation_relkindlabels are referenced later in functions created in the same update, and the same pattern repeats forobject_typefurther down the file. Add an intermediate update that only adds the enum values, then create/use them in the next step.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@sql/cat_tools--0.2.2--0.3.0.sql.in` around lines 181 - 186, Split the enum changes into a standalone intermediate upgrade step: add the new relation_type and relation_relkind values there, and likewise isolate the object_type additions later in the migration. Ensure the following upgrade step creates or updates functions that reference these labels only after the enum additions have been committed.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In @.github/workflows/ci.yml:
- Around line 16-36: Add a top-level permissions block to the workflow
configuration, granting only contents: read for the checkout performed by the
test job. Keep the existing test matrix, container, and steps unchanged.
In `@META.json`:
- Around line 70-75: Update the X_comment metadata in META.in.json to describe
the PostgreSQL 12.0 requirement instead of the outdated 9.2 prerequisite, then
regenerate META.json so the generated metadata matches the source and the
existing PostgreSQL requires value.
In `@README.asc`:
- Line 23: Update the README’s supported-version statement from PostgreSQL 9.3
and above to PostgreSQL 12 and above, matching the documented support range in
HISTORY.asc.
In `@sql/cat_tools--0.2.2--0.3.0.sql.in`:
- Around line 181-186: Split the enum changes into a standalone intermediate
upgrade step: add the new relation_type and relation_relkind values there, and
likewise isolate the object_type additions later in the migration. Ensure the
following upgrade step creates or updates functions that reference these labels
only after the enum additions have been committed.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 03c99a1c-668e-4f5a-b2b9-6c83a240a2be
⛔ Files ignored due to path filters (3)
test/expected/permissions.outis excluded by!**/*.outtest/expected/relation__.outis excluded by!**/*.outtest/expected/routine__.outis excluded by!**/*.out
📒 Files selected for processing (9)
.github/workflows/ci.ymlHISTORY.ascMETA.in.jsonMETA.jsonREADME.ascsql/cat_tools--0.2.2--0.3.0.sql.insql/cat_tools--0.3.0.sql.insql/cat_tools.sql.intest/sql/relation__.sql
The 0.2.2→0.3.0 update was only tested on PG12. PG12 is the floor (ALTER TYPE ... ADD VALUE cannot run in an update script on PG11 and below), but there is no upper bound: 0.2.2 installs cleanly on PG12+, so the update runs on every version 0.3.0 supports. Verified locally on PG17. Expand the matrix to 12–18 and update the CLAUDE.md note accordingly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…E + manual GRANT
function__arg_to_regprocedure and function__drop_temp were created with a bare
CREATE FUNCTION followed by hand-written REVOKE-from-PUBLIC + GRANT statements.
That hand-written REVOKE is exactly what drifted between the fresh-install and
update scripts (the update path had dropped it). Route both helpers through
__cat_tools.create_function, which applies REVOKE ALL FROM public + GRANT to
cat_tools__usage from its templates, so the ACL is defined once and cannot
diverge between the two scripts.
In the fresh-install script create_function runs while routine__parse_arg_types_text
is still the pass-through stub, so the generated REVOKE/GRANT carry argument
names rather than bare types; PostgreSQL ignores argument names when matching a
function signature, so the resulting ACL is identical (verified
{root=X/root,cat_tools__usage=X/root} on both fresh install and the 0.2.2→0.3.0
update path). Regenerate test/build/expected/build.out for the two added void
SELECT outputs.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The relation__ test asserts the mapping against a hard-coded relkind data set (`kinds`). Add a drift check that compares that hard-coded set against the relkinds the PostgreSQL being built against actually defines: test/gen-relkinds.sh extracts every RELKIND_* value from the server's catalog/pg_class.h into a temp view, and the test fails if pg_class.h defines a relkind absent from `kinds` (i.e. PostgreSQL added or renamed one and the enum/mapping/test data need updating). A relkind in `kinds` that an older PostgreSQL lacks is ignored. Output is stable: the assertion is string_agg of the unknown relkinds, which is NULL (pass) on every supported version since the relkind set is identical across PG12–18. When postgresql-server-dev-NN is not installed the generated view is empty, giving the same NULL/pass, so `make test` produces identical output with or without the headers. The CI test job now installs the -server-dev package so the check runs for real on all matrix versions; jobs without it skip vacuously. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
pg_procfields:routine_type,routine_argument_mode,routine_volatility,routine_parallel_safetyrelation__is_temp,relation__is_catalog,relation__column_namesrun-test-build.sh,verify-results-pgtap.sh, and more)attmissingvaland PG12+oidvisibility breakage in pre-0.2.2 scripts0.1.0,0.2.1,0.2.2) now tracked in git